package com.lzy.cloud.ticket.admission.controller;

import com.lzy.cloud.ticket.admission.dtos.*;
import com.lzy.cloud.ticket.admission.service.TicketService;
import com.lzy.framework.core.ensure.Ensure;
import com.lzy.framework.core.output.Result;
import com.lzy.framework.core.utils.DozerUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/test")
public class AdmissionController {

    @Autowired
    private TicketService ticketService;

    /**
     * 查询景点列表
     * @param selectTicketListListDto
     * @return
     */
    @RequestMapping(value = "/select/list" ,method = RequestMethod.GET )
    public Result select(SelectTicketListListDto selectTicketListListDto){
        return ticketService.scenicList(selectTicketListListDto);
    }
    /**
     * 查询景点详情
     */
    @RequestMapping(value = "/select/detail",method = RequestMethod.GET)
    public Result selectDetail(ScenicDetailDto scenicDetailDto){
        return ticketService.scenicDetail(scenicDetailDto);
    }

    /**
     * 查询门票详情
     */
    @RequestMapping(value = "/ticket/detail",method = RequestMethod.GET)
    public Result ticketDetail(SelectTicketDetailDto selectTicketDetailDto){
        return ticketService.detail(selectTicketDetailDto);
    }

    /**
     * 创建订单
     */
    @RequestMapping(value = "/create/order",method = RequestMethod.POST)
    public Result createOrder(String request){
        return ticketService.createOrderNew(request);
    }

    /**
     * 取消订单
     */
    @RequestMapping(value = "/cancle/order",method = RequestMethod.POST)
    public Result cancleOrder(String request){
        return ticketService.cancelOrder(request);
    }

    /**
     * 查询订单状态
     */
    @RequestMapping(value = "/order/status",method = RequestMethod.POST)
    public Result orderStatus(String request){
        return ticketService.orderStatus(request);

    }

    /**
     * 查询订单详情
     */
    @RequestMapping(value = "/order/detail",method = RequestMethod.POST)
    public Result orderDetail(String request){
        return ticketService.orderDetail(request);
    }


    /**
     * 查询是否可退
     */
    @RequestMapping(value = "/is/refund",method = RequestMethod.POST)
    public Result isRefund(String request){
        return ticketService.canRefundTicket(request);

    }

    /**
     * 在线退票申请
     */
    @RequestMapping(value = "/online/refund",method = RequestMethod.POST)
    public Result onlineRefund(String request){
        return ticketService.onLineRefund(request);

    }

    /**
     * 门票核销查询
     */
    @RequestMapping(value = "/verify/order",method = RequestMethod.POST)
    public Result verifyOrder(String request){
        return ticketService.verifyOrder(request);

    }

}
